﻿using System;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;

namespace SpectrumAnalyser.Config.Service
{
    public class FooAttribute : HandlerAttribute
    {
        public override ICallHandler CreateHandler(IUnityContainer container)
        {
            return new NotifyPropertyChangedHandler();
        }
    }

    internal class NotifyPropertyChangedHandler : ICallHandler
    {
        public IMethodReturn Invoke(IMethodInvocation input, GetNextHandlerDelegate getNext)
        {
            //TODO:
            //(input.Target as Interface).Propert = ...
            //Set repository Property using DataContext
            var result = getNext()(input, getNext);

            return result;
        }

        public int Order { get; set; }
    }
}